package mlpEnsemble;

import genetic_algorithm.Chromosome;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

import utils.RandomGenerator;

public class MlpEnsembleChromosome implements Chromosome, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3834003663155643761L;
	List<int[]> indexesList;
	
	public MlpEnsembleChromosome(int mlpListSize, int chromosomeSize)
	{

		indexesList = new LinkedList<int[]>();
		for(int i = 0  ; i < chromosomeSize ; ++i)
		{
			int[] mlps = new int[10];
			for(int j= 0 ; j < 10 ; j++)
			{
				mlps[j] = RandomGenerator.nextInt(mlpListSize);
			}
			indexesList.add(mlps);
		}
	}
	
	
	public MlpEnsembleChromosome(LinkedList<int[]> indexesList) {
		this.indexesList = indexesList;
	}
	
	@Override
	public int[] getValue(int index) throws IllegalArgumentException {
		return indexesList.get(index);
	}

	@Override
	public void setValue(int index, Object obj) throws IllegalArgumentException {
		indexesList.set(index, (int[])obj);
	}

	@Override
	public List<Object> getAllValues() {
		return new LinkedList<Object>(indexesList);
	}
	
	public List<int[]> getAllIndices() {
		return new LinkedList<int[]>(indexesList);
	}
}
